/**
 * creater:chuanpeng.zhu@dhc.com.cn
 * create time:2016-06-08 10:59:54
 * describe:列表侧滑菜单
 */
APP.controller('OptionButtonController', ['$scope', 'OptionButtonService', '$ionicListDelegate',
  function ($scope, OptionButtonService, $ionicListDelegate) {

    /***变量声明***/
    $scope.username = undefined;
    $scope.password = undefined;

    /**
     * 初始化函数
     */
    $scope.init = function () {

    };

    /**
     * 侧滑菜单按钮点击
     */
    $scope.obDelete = function () {
      console.log('点击了侧滑菜单！');
      $ionicListDelegate.closeOptionButtons();
    };


    /*
     $scope.init();//如果页面缓存则用此方法初始化
     */
    $scope.$on('$ionicView.beforeEnter', function () {
      $scope.init();
    });
  }
]);

/**
 * creater:chuanpeng.zhu@dhc.com.cn
 * create time:2016-06-08 10:59:54
 * describe:列表侧滑菜单
 */
APP.service('OptionButtonService', ['$http', 'UrlService', function ($http, UrlService) {
  /**
   * 登录方法
   * @param username  登录用户名
   * @param password  登录密码
   */
  this.doLogin = function (username, password) {
    var param = {
      username: username,
      password: password
    };
    $http.post(UrlService.getUrl('LOGIN'), param);
  }

}]);
